package com.cli.apisdk.interceptor;

import com.github.lianjiatech.retrofit.spring.boot.interceptor.GlobalInterceptor;
import okhttp3.Request;
import okhttp3.Response;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * @author: xiongmin
 * @since create by 2022/7/20 9:46
 */
@Component
public class HeaderGlobalInterceptor implements GlobalInterceptor {

    @Override
    public Response intercept(Chain chain) throws IOException {
        Request request = chain.request();
        Request newReq = request.newBuilder()
                .addHeader("Content-Type", "application/json")
                .build();
        return chain.proceed(newReq);
    }
}
